﻿using System;

namespace Aquarinum.WebSocekt.Core.Dtos
{
    public class ApiResult
    {
        public ApiResult()
        {
        }

        /// <summary>
        ///     构造函数
        /// </summary>
        /// <param name="code">返回码</param>
        public ApiResult(ApiResultCode code) : this(code, string.Empty, string.Empty)
        {
        }

        /// <summary>
        ///     构造函数
        /// </summary>
        /// <param name="code">返回码</param>
        /// <param name="msg">信息提示</param>
        public ApiResult(ApiResultCode code, string msg) : this(code, msg, string.Empty)
        {
        }

        /// <summary>
        ///     构造函数
        /// </summary>
        /// <param name="code">返回码</param>
        /// <param name="msg">信息提示</param>
        /// <param name="data">数据实体</param>
        public ApiResult(ApiResultCode code, string msg, object data)
        {
            Code = code;
            Msg = msg;
            Data = data;
        }

        /// <summary>
        ///     返回码
        /// </summary>
        public ApiResultCode Code { get; set; }

        /// <summary>
        ///     返回信息
        /// </summary>
        public string Msg { get; set; }

        /// <summary>
        ///     返回值
        /// </summary>
        public object Data { get; set; }

        /// <summary>
        ///     服务器时间
        /// </summary>
        public long Servertime { get; set; } = DateTime.UtcNow.Ticks;
    }
}